#ifndef _BUOLA_GUI_COCOA_CAGLCONTEXT_H_
#define _BUOLA_GUI_COCOA_CAGLCONTEXT_H_

#include "auto.h"
#include "ccocoawindow.h"
#include <buola/gl/ccontext.h>

namespace buola { namespace gui { namespace cocoa {

DECLARE_NAME(ReferenceContext);
DECLARE_NAME(WithoutWindow);

class CAGLContext : public gl::CContext
{
public:
    CAGLContext(CCocoaWindow *pWindow);
    CAGLContext(NReferenceContext);
    CAGLContext(NWithoutWindow);
    virtual ~CAGLContext();

    virtual img::CSurface *Surface() {   return mWindow;    }
    virtual void MakeCurrent(img::CSurface *pSurface);
    virtual bool IsCurrent();
    virtual void SwapBuffers();

private:
    CCocoaWindow *mWindow;
    NSOpenGLContext *mContext;

    static CAGLContext *mReferenceContext;
    //static CX11Window *mFakeWindow;
};

/*namespace cocoa*/ } /*namespace gui*/ } /*namespace buola*/ }

#endif
